<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>货品列表页</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
	    <!-- Loading Bootstrap -->
	    <link href="./Public/Admin/Flat/dist/css/vendor/bootstrap.min.css" rel="stylesheet">
    	<!--Loading JQ-->
    	<script type="text/javascript" src="./Public/Home/js/jquery-2.2.2.min.js"></script>
	    <!-- Loading Flat UI -->
	    <link href="./Public/Admin/Flat/dist/css/flat-ui.css" rel="stylesheet">
	    <link href="./Public/Admin/Flat/docs/assets/css/demo.css" rel="stylesheet">
	    <link rel="shortcut icon" href="./Public/Admin/Flat/img/favicon.ico">
    	<style type="text/css">
    	    th,tr{
    	    	text-align: center;
    	    }
    	</style>
    </head>
    <body>
  		<div class="container-fluid" style="padding-top: 10px;">
  			<form action="" method="post">
  			  	<table class="table table-bordered table-hover">
  			  	    <tr>
  			  	    	<th>货品id</th>
  			  	    	<?php foreach ($adata as $v){?>
  			  	    	<th><?php echo $v['aname']?></th>
  			  	    	<?php }?>
  			  	    	<th>库存</th>
  			  	    	<th>货号</th>
  			  	    	<th>操作</th>
		  	    	</tr>
		  	    	
		  	    	
		  	    	
		  	    	<?php foreach ($data as $k=>$v){?>
		  	    	<tr>
  			  	    	<td><?php echo $v['glid']?></td> 
  			  	    	
  			  	    	
  			  	    	<?php $arr=explode(',', $v['combine']);?> 
  			  	    	<?php foreach ($adata as $vo){?>	
  			  	    	<td>
  			  	    		
		  	    			<?php foreach ($vo['son'] as $vv){?>	
		  	    				<?php if(in_array($vv['gtid'],$arr)){?>
                
		  	    				<?php echo $vv['gtvalue'] ?>
	  	    					
               <?php }?>
    						<?php }?>
  			  	    	</td>
  			  	    	<?php }?>	
  			  	    	
  			  	    	
  			  	    		  	    	
  			  	    	<td><?php echo $v['number']?></td>
  			  	    	<td><?php echo $v['inventory']?></td>
  			  	    	<td>
  			  	    		<a class="btn btn-default" href="<?php echo U('edit',array('glid'=>$v['glid'],'gid'=>$v['goods_gid']))?>">修改</a>
  			  	    		<a class="btn btn-danger" href="javascript:if(confirm('你确定要删除吗?')) location.href='<?php echo U('del',array('glid'=>$v['glid']))?>';">删除</a>
  			  	    	</td>
	  	    		</tr>
		  	    	<?php }?>	
		  	    	
		  	    	
		  	    	  	    	
		  	    	<tr>
  			  	    	<td>添加货品</td>
  			  	    	<?php foreach ($adata as $v){?>
  			  	    	<td>
		  	    			<select name="a[]" class="form-control">
		  	    			    <option value="0">请选择</option>
		  	    				<?php foreach ($v['son'] as $vv){?>
		  	    			    <option value="<?php echo $vv['gtid']?>"><?php echo $vv['gtvalue']?></option>
		  	    			    <?php }?>
		  	    			</select>
  			  	    	</td>
  			  	    	<?php }?>
  			  	    	<td>
  			  	    		<input type="text" name="inventory" id="" value="" class="form-control"/>
  			  	    	</td>
  			  	    	<td>
  			  	    		<input type="text" name="number" id="" value="" class="form-control"/>
  			  	    	</td>
  			  	    	<td>
  			  	    		<input type="submit" value="保存添加" class="btn btn-success"/>
  			  	    	</td>
	  	    	</tr>		  	    	
  			  	</table>  
  			</form>
		</div>
    </body>
</html>